<?php
$att_options = array(
				'1'=>'Present',
				'0'=>'Absent',
				'2'=>'Tardy',
				'3'=>'Cut Class'
);
?>
<div class="row">
	<div class="panel callout"><h6>Class Attendance</h6></div>
		<?php echo validation_errors(); ?>
		<?if(isset($system_message)) :?>
			<?=$system_message;?>
		<?else:?>
			<?require 'navigation/class_nav.php'?>
			<div class="panel"><h6><?=date('F d, Y', strtotime($date));?></h6></div>
			<?=form_open('teacher/view_edit_attendance/' . $room_id . '/' . date('Y-m-d', strtotime($date)), array('class'=>'custom submit_forms')) ?>
				<table>
					<thead>
						<tr>
							<th>Student</th>
							<th>Attendance</th>
							<th>Reason</th>
							<th>Remarks</th>
						</tr>
						<tbody>
							<?foreach($now_att as $att): ?>
							<?$id = $att->profile_id; ?>
							<?$id_arr[] = $id; ?>
								<tr>
									<td><?=strtoupper($att->lastname) . ', ' . ucfirst($att->firstname) . ' ' . ucfirst($att->middlename); ?><br />
										<?=$att->profile_id?>
									</td>
									<td>
										<?$att_value = set_value('attendance[' . $id . '][in_class]') == FALSE ? $att->in_class : set_value('attendance[' . $id . '][in_class]');?>
										<?=form_dropdown('attendance[' . $id . '][in_class]', $att_options,$att_value,'id="customDropdown"'); ?>
									</td>
									<td>
										<?$rea_value = set_value('attendance[' . $id . '][reason]') == FALSE ? $att->reason : set_value('attendance[' . $id . '][reason]');?>
										
										<?=form_input('attendance[' . $id . '][reason]',$rea_value,'class="large-12 columns"'); ?>
									</td>
									<td>
										<?$rem_value = set_value('attendance[' . $id . '][remarks]') == FALSE ? $att->remarks : set_value('attendance[' . $id . '][remarks]');?>
										<?=form_input('attendance[' . $id . '][remarks]',$rem_value,'class="large-12 columns"'); ?>
									</td>
								</tr>
							<?endforeach;?>
						</tbody>
					</thead>
				</table>
			<?=form_hidden('section_id', $section_id); ?>
			<?=form_hidden('id_arr', $id_arr); ?>
			<a href="#" class="button small success radius submit_btns">Update Attendance</a>
			<?=form_close(); ?>
		<?endif;?>
</div>